package com.example.smart.ui.activity.home

import com.example.lib.extend.setOnDoubleClickListener
import com.example.lib.utils.ToastUtils
import com.example.lib.utils.statusbar.StatusBarUtils
import com.example.smart.R
import com.example.smart.base.ui.activity.BaseTitleBarActivity
import com.example.smart.databinding.ActivityDeviceBinding

class DeviceActivity : BaseTitleBarActivity<ActivityDeviceBinding>() {
    private var open1 = true
    private var open2 = true
    override fun layoutID() = R.layout.activity_device

    override fun initView() {
        StatusBarUtils.setStateAndNavigationBar(this@DeviceActivity,
            statusBarColor = com.example.lib.R.color.black_ececf8)
        setTitle("设备管理")
        setAppBarColor(getColor(com.example.lib.R.color.black_ececf8))

    }

    override fun initListener() {
        binding.Image1.setOnDoubleClickListener {
            if (open1) {
                binding.Image1.setImageResource(R.mipmap.icon_not_sex)
                ToastUtils.showToast("设备已关闭")
            } else {
                binding.Image1.setImageResource(R.mipmap.icon_already_sex)
                ToastUtils.showToast("设备已打开")
            }
            open1 = !open1
        }

        binding.Image2.setOnDoubleClickListener {
            if (open2) {
                binding.Image2.setImageResource(R.mipmap.icon_not_sex)
                ToastUtils.showToast("设备已关闭")
            } else {
                binding.Image2.setImageResource(R.mipmap.icon_already_sex)
                ToastUtils.showToast("设备已打开")
            }
            open2 = !open2
        }
    }
}